import request from "../request";

export const createProduct = async (data) => {
  return request({ url: "/api/products", method: "POST", data });
};

export const getProducts = async () => {
  return request({ url: "/api/products" });
};

export const updateProduct = async (data) => {
  return request({
    url: `/api/products`,
    method: "PUT",
    data,
  });
};

export const deleteProduct = async (id) => {
  return request({
    url: `/api/products`,
    method: "DELETE",
    params: { id },
  });
};

export const getProduct = async (id) => {
  return request({
    url: `/api/products/${id}`,
  });
};
